home *** CD-ROM | disk | FTP | other *** search
/ Kentucky Virtual Art Museum / Kentucky Virtual Art Museum.iso / site / museums / galleries / galleryTime.swf / scripts / FScrollPaneSymbol.as < prev    next >
Text File  |  2005-08-25  |  10KB  |  320 lines

  1. function FScrollPaneClass()
  2. {
  3.    function boolToString(str)
  4.    {
  5.       var _loc1_ = str;
  6.       if(_loc1_ == "false")
  7.       {
  8.          return false;
  9.       }
  10.       if(_loc1_ == "true")
  11.       {
  12.          return true;
  13.       }
  14.       return _loc1_;
  15.    }
  16.    var _loc1_ = this;
  17.    _loc1_.init();
  18.    _loc1_.width = _loc1_._width;
  19.    _loc1_.height = _loc1_._height;
  20.    _loc1_._xscale = _loc1_._yscale = 100;
  21.    _loc1_.contentWidth = _loc1_.contentHeight = 0;
  22.    if(_loc1_.hScroll == undefined)
  23.    {
  24.       _loc1_.hScroll = _loc1_.vScroll = "auto";
  25.       _loc1_.dragContent = false;
  26.    }
  27.    _loc1_.offset = new Object();
  28.    _loc1_.vScroll = boolToString(_loc1_.vScroll);
  29.    _loc1_.hScroll = boolToString(_loc1_.hScroll);
  30.    _loc1_.attachMovie("FScrollBarSymbol","hScrollBar_mc",100,{hostStyle:_loc1_.styleTable});
  31.    _loc1_.hScrollBar_mc.setHorizontal(true);
  32.    _loc1_.hScrollBar_mc.setSmallScroll(5);
  33.    _loc1_.hScrollBar_mc.setChangeHandler("onScroll",_loc1_);
  34.    _loc1_.attachMovie("FScrollBarSymbol","vScrollBar_mc",99,{hostStyle:_loc1_.styleTable});
  35.    _loc1_.vScrollBar_mc.setSmallScroll(5);
  36.    _loc1_.vScrollBar_mc.setChangeHandler("onScroll",_loc1_);
  37.    _loc1_.setSize(_loc1_.width,_loc1_.height);
  38.    if(_loc1_.scrollContent != "")
  39.    {
  40.       _loc1_.setScrollContent(_loc1_.scrollContent);
  41.    }
  42.    _loc1_.setDragContent(_loc1_.dragContent);
  43. }
  44. FScrollPaneClass.prototype = new FUIComponentClass();
  45. Object.registerClass("FScrollPaneSymbol",FScrollPaneClass);
  46. FScrollPaneClass.prototype.getScrollContent = function()
  47. {
  48.    return this.content_mc;
  49. };
  50. FScrollPaneClass.prototype.getPaneWidth = function()
  51. {
  52.    return this.width;
  53. };
  54. FScrollPaneClass.prototype.getPaneHeight = function()
  55. {
  56.    return this.height;
  57. };
  58. FScrollPaneClass.prototype.getScrollPosition = function()
  59. {
  60.    var _loc1_ = this;
  61.    var _loc3_ = _loc1_.hScrollBar_mc != undefined ? _loc1_.hScrollBar_mc.getScrollPosition() : 0;
  62.    var _loc2_ = _loc1_.vScrollBar_mc != undefined ? _loc1_.vScrollBar_mc.getScrollPosition() : 0;
  63.    return {x:_loc3_,y:_loc2_};
  64. };
  65. FScrollPaneClass.prototype.setScrollContent = function(target)
  66. {
  67.    var _loc1_ = this;
  68.    var _loc2_ = target;
  69.    _loc1_.offset.x = 0;
  70.    _loc1_.offset.y = 0;
  71.    if(_loc1_.content_mc != undefined)
  72.    {
  73.       if(_loc2_ != _loc1_.content_mc)
  74.       {
  75.          _loc1_.content_mc._visible = false;
  76.          _loc1_.content_mc.removeMovieClip();
  77.          _loc1_.content_mc.unloadMovie();
  78.       }
  79.    }
  80.    if(typeof _loc2_ == "string")
  81.    {
  82.       _loc1_.attachMovie(_loc2_,"tmp_mc",3);
  83.       _loc1_.content_mc = _loc1_.tmp_mc;
  84.    }
  85.    else if(_loc2_ == undefined)
  86.    {
  87.       _loc1_.content_mc.unloadMovie();
  88.    }
  89.    else
  90.    {
  91.       _loc1_.content_mc = _loc2_;
  92.    }
  93.    _loc1_.localToGlobal(_loc1_.offset);
  94.    _loc1_.content_mc._parent.globalToLocal(_loc1_.offset);
  95.    _loc1_.content_mc._x = _loc1_.offset.x;
  96.    _loc1_.content_mc._y = _loc1_.offset.y;
  97.    var _loc3_ = _loc1_.content_mc.getBounds(_loc1_);
  98.    _loc1_.offset.x = - _loc3_.xMin;
  99.    _loc1_.offset.y = - _loc3_.yMin;
  100.    _loc1_.localToGlobal(_loc1_.offset);
  101.    _loc1_.content_mc._parent.globalToLocal(_loc1_.offset);
  102.    _loc1_.content_mc._x = _loc1_.offset.x;
  103.    _loc1_.content_mc._y = _loc1_.offset.y;
  104.    _loc1_.contentWidth = _loc1_.content_mc._width;
  105.    _loc1_.contentHeight = _loc1_.content_mc._height;
  106.    _loc1_.content_mc.setMask(_loc1_.mask_mc);
  107.    _loc1_.setSize(_loc1_.width,_loc1_.height);
  108. };
  109. FScrollPaneClass.prototype.setSize = function(w, h)
  110. {
  111.    var _loc1_ = this;
  112.    var _loc2_ = h;
  113.    var _loc3_ = w;
  114.    if(!(arguments.length < 2 || isNaN(_loc3_) || isNaN(_loc2_)))
  115.    {
  116.       super.setSize(_loc3_,_loc2_);
  117.       _loc1_.width = Math.max(_loc3_,60);
  118.       _loc1_.height = Math.max(_loc2_,60);
  119.       _loc1_.boundingBox_mc._xscale = 100;
  120.       _loc1_.boundingBox_mc._yscale = 100;
  121.       _loc1_.boundingBox_mc._width = _loc1_.width;
  122.       _loc1_.boundingBox_mc._height = _loc1_.height;
  123.       _loc1_.setHandV();
  124.       _loc1_.initScrollBars();
  125.       if(_loc1_.mask_mc == undefined)
  126.       {
  127.          _loc1_.attachMovie("FBoundingBoxSymbol","mask_mc",3000);
  128.       }
  129.       _loc1_.mask_mc._xscale = 100;
  130.       _loc1_.mask_mc._yscale = 100;
  131.       _loc1_.mask_mc._width = _loc1_.hWidth;
  132.       _loc1_.mask_mc._height = _loc1_.vHeight;
  133.       _loc1_.mask_mc._alpha = 0;
  134.    }
  135. };
  136. FScrollPaneClass.prototype.setScrollPosition = function(x, y)
  137. {
  138.    var _loc1_ = this;
  139.    var _loc2_ = y;
  140.    var _loc3_ = x;
  141.    _loc3_ = Math.max(_loc1_.hScrollBar_mc.minPos,_loc3_);
  142.    _loc3_ = Math.min(_loc1_.hScrollBar_mc.maxPos,_loc3_);
  143.    _loc2_ = Math.max(_loc1_.vScrollBar_mc.minPos,_loc2_);
  144.    _loc2_ = Math.min(_loc1_.vScrollBar_mc.maxPos,_loc2_);
  145.    _loc1_.hScrollBar_mc.setScrollPosition(_loc3_);
  146.    _loc1_.vScrollBar_mc.setScrollPosition(_loc2_);
  147. };
  148. FScrollPaneClass.prototype.refreshPane = function()
  149. {
  150.    this.setScrollContent(this.content_mc);
  151. };
  152. FScrollPaneClass.prototype.loadScrollContent = function(url, handler, location)
  153. {
  154.    var _loc1_ = this;
  155.    _loc1_.content_mc.removeMovieClip();
  156.    _loc1_.content_mc.unloadMovie();
  157.    _loc1_.content_mc._visible = 0;
  158.    _loc1_.loadContent.duplicateMovieClip("loadTemp",3);
  159.    _loc1_.dupeFlag = true;
  160.    _loc1_.contentLoaded = function()
  161.    {
  162.       var _loc1_ = this;
  163.       _loc1_.loadReady = false;
  164.       _loc1_.content_mc = _loc1_.loadTemp;
  165.       _loc1_.refreshPane();
  166.       _loc1_.executeCallBack();
  167.    };
  168.    _loc1_.setChangeHandler(handler,location);
  169.    _loc1_.loadTemp.loadMovie(url);
  170. };
  171. FScrollPaneClass.prototype.setHScroll = function(prop)
  172. {
  173.    var _loc1_ = this;
  174.    _loc1_.hScroll = prop;
  175.    _loc1_.setSize(_loc1_.width,_loc1_.height);
  176. };
  177. FScrollPaneClass.prototype.setVScroll = function(prop)
  178. {
  179.    var _loc1_ = this;
  180.    _loc1_.vScroll = prop;
  181.    _loc1_.setSize(_loc1_.width,_loc1_.height);
  182. };
  183. FScrollPaneClass.prototype.setDragContent = function(dragFlag)
  184. {
  185.    var _loc1_ = this;
  186.    if(dragFlag)
  187.    {
  188.       _loc1_.boundingBox_mc.useHandCursor = true;
  189.       _loc1_.boundingBox_mc.onPress = function()
  190.       {
  191.          this._parent.startDragLoop();
  192.       };
  193.       _loc1_.boundingBox_mc.tabEnabled = false;
  194.       _loc1_.boundingBox_mc.onRelease = _loc1_.boundingBox_mc.onReleaseOutside = function()
  195.       {
  196.          this._parent.pressFocus();
  197.          this._parent.onMouseMove = null;
  198.       };
  199.    }
  200.    else
  201.    {
  202.       delete _loc1_.boundingBox_mc.onPress;
  203.       _loc1_.boundingBox_mc.useHandCursor = false;
  204.    }
  205. };
  206. FScrollPaneClass.prototype.setSmallScroll = function(x, y)
  207. {
  208.    this.hScrollBar_mc.setSmallScroll(x);
  209.    this.vScrollBar_mc.setSmallScroll(y);
  210. };
  211. FScrollPaneClass.prototype.setHandV = function()
  212. {
  213.    var _loc1_ = this;
  214.    if(_loc1_.contentHeight - _loc1_.height > 2 && _loc1_.vScroll != false || _loc1_.vScroll == true)
  215.    {
  216.       _loc1_.hWidth = _loc1_.width - _loc1_.vScrollBar_mc._width;
  217.    }
  218.    else
  219.    {
  220.       _loc1_.hWidth = _loc1_.width;
  221.    }
  222.    if(_loc1_.contentWidth - _loc1_.width > 2 && _loc1_.hScroll != false || _loc1_.hScroll == true)
  223.    {
  224.       _loc1_.vHeight = _loc1_.height - _loc1_.hScrollBar_mc._height;
  225.    }
  226.    else
  227.    {
  228.       _loc1_.vHeight = _loc1_.height;
  229.    }
  230. };
  231. FScrollPaneClass.prototype.startDragLoop = function()
  232. {
  233.    var _loc1_ = this;
  234.    _loc1_.tabFocused = false;
  235.    _loc1_.myOnSetFocus();
  236.    _loc1_.lastX = _loc1_._xmouse;
  237.    _loc1_.lastY = _loc1_._ymouse;
  238.    _loc1_.onMouseMove = function()
  239.    {
  240.       var _loc1_ = this;
  241.       _loc1_.scrollXMove = _loc1_.lastX - _loc1_._xmouse;
  242.       _loc1_.scrollYMove = _loc1_.lastY - _loc1_._ymouse;
  243.       _loc1_.scrollXMove += _loc1_.hScrollBar_mc.getScrollPosition();
  244.       _loc1_.scrollYMove += _loc1_.vScrollBar_mc.getScrollPosition();
  245.       _loc1_.setScrollPosition(_loc1_.scrollXMove,_loc1_.scrollYMove);
  246.       if(_loc1_.scrollXMove < _loc1_.hScrollBar_mc.maxPos && _loc1_.scrollXMove > _loc1_.hScrollBar_mc.minPos)
  247.       {
  248.          _loc1_.lastX = _loc1_._xmouse;
  249.       }
  250.       if(_loc1_.scrollYMove < _loc1_.vScrollBar_mc.maxPos && _loc1_.scrollYMove > _loc1_.vScrollBar_mc.minPos)
  251.       {
  252.          _loc1_.lastY = _loc1_._ymouse;
  253.       }
  254.